<template>
    <div class="box">
        <div v-for="(item,index) in list" 
        :key="index" class="centent" 
        @click="changebar(index,item.path)" 
        :class="(realelement === index)?'light':''"><div :class="'iconfont '+item.icon"></div>{{item.name}}</div>
    </div>
</template>

<script>
export default {
    data(){
        return {
            list:[
            {name:'首页',icon:'icon-a-shouyezhuye',path:'/home'},
            {name:'探索',icon:'icon-a-faxianquanzi',path:'/world'},
            {name:'我的',icon:'icon-wode',path:'/my'}],
            realelement:''
        }
    },
    methods:{
        changebar(index,path){
            this.realelement = index
            this.$router.push(path)
        }
    }
}
</script>

<style lang="scss" scoped>
.box{
    position: fixed;
    bottom: 0;
    width: 100%;
    background-color: rgb(239, 239, 239);
    height: 0.55rem;
    z-index: 99;
}
.centent{
    float: left;
    width: 33%;
    color: rgb(74, 152, 126);
    border-bottom: 2px solid rgb(74, 152, 126);
    text-align: center;
    height: 0.5rem;
}
.light{
    border-bottom-color: lightpink;
    color: lightpink;
}
</style>